<!--
 * @Author: ChengNan 1429323234@qq.com
 * @Date: 2024-09-05 10:55:08
 * @LastEditors: ChengNan 1429323234@qq.com
 * @LastEditTime: 2024-09-05 11:11:25
 * @FilePath: /src/views/0.web-front/7天入门/7.背景.html
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box1 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
    }
    .box2 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
    }
    .box3 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
      background-size: contain;
    }
    .box4 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
      background-size: cover;
    }
    .box5 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
    .box6 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
      background-size: 50% 50%;
    }
    .box7 {
      width: 200px;
      height: 150px;
      border: 1px solid red;
      background-image: url("https://picsum.photos/50/100");
      background-repeat: no-repeat;
      background-size: 50% 50%;
      background-position: center center;
    }
  </style>
</head>
<body>
  <h1>1.背景重复</h1>
  <div class="box1"></div>
  <h1>2。背景不重复</h1>
  <div class="box2"></div>
  <h1>3.背景填充</h1>
  <div class="box3"></div>
  <div class="box4"></div>
  <div class="box5"></div>
  <div class="box6"></div>
  <h1>4.背景位移</h1>
  <div class="box7"></div>
</body>
</html>